package com.beauty.order.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderRequest {
    
    @NotBlank(message = "客户ID不能为空")
    private String customerId;
    
    @NotEmpty(message = "订单项不能为空")
    @Valid
    private List<OrderItemRequest> orderItems;
    
    private BigDecimal shippingCost;
    
    private BigDecimal taxAmount;
    
    @NotBlank(message = "支付方式不能为空")
    private String paymentMethod;
    
    @NotBlank(message = "配送方式不能为空")
    private String shippingMethod;
    
    @NotBlank(message = "配送地址不能为空")
    private String shippingAddress;
    
    @NotBlank(message = "账单地址不能为空")
    private String billingAddress;
    
    private String notes;
    
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class OrderItemRequest {
        
        @NotBlank(message = "产品ID不能为空")
        private String productId;
        
        @NotBlank(message = "产品名称不能为空")
        private String productName;
        
        private String productImage;
        
        @NotNull(message = "数量不能为空")
        private Integer quantity;
        
        @NotNull(message = "单价不能为空")
        private BigDecimal unitPrice;
        
        private BigDecimal discountAmount;
        
        private String sku;
        
        private Map<String, String> options;
    }
}